package etnorservice.etnor_service.domain.dto;

import etnorservice.etnor_service.emus.DeployStep;
import lombok.Builder;
import lombok.Data;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: cc
 * @Date: 2025/03/19/20:41
 **/
@Data
@Builder
public class WebSocketMessage {
    private String type;  // progress/log
    private DeployStep step;
    private Integer progress;
    private String message;

    public static WebSocketMessage progress(DeployStep step, int progress) {
        return WebSocketMessage.builder()
                .type("progress")
                .step(step)
                .progress(progress)
                .build();
    }

    public static WebSocketMessage log(DeployStep step, String message) {
        return WebSocketMessage.builder()
                .type("log")
                .step(step)
                .message(message)
                .build();
    }
}